<html>
<body>
Reports use of the <b>synchronized</b> modifier on methods.
There are several reasons a <b>synchronized</b> modifier on a method may be a bad idea:
First, as a rule as little work as possible should be performed under a lock.
Therefore it is often better to use a <b>synchronized</b> statement and move as much of the methods code outside the
<b>synchronized</b> region.
Second, it makes synchronization part of the external interface of the class.
This makes a future change to a different locking mechanism difficult.
Third, it makes it hard to track just who is locking on a given object.
And fourth, it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing.

<p>
As an alternative, consider
synchronizing on a <b>private final</b> lock object, access to which can be completely controlled.
<!-- tooltip end -->
<p>

</body>
</html>